#ifndef MSG_XY_H
#define MSG_XY_H
/*************************************************************************
 *
 * Module:	msg_xy.h 
 *
 * Purpose:	Define structs for messages that are common to 2 or
 *		more node pairs.
 *
 * Dependencies:  ebs_defn.h
 *
 * Author:	H.Cinamon
 *
 * Modification History (latest first):
 * Rv	Date	  By		Reason for change
 * ---  --------  -----------   ---------------------------------------------
 * 17   04/28/03  A.Foray       Added batch message: ALRBATCHRESPONSE 
 *                              also ALRDATARESPONES2 to fix design bug!!
 * 16   10/03/02  A.Foray       Added messages for benchmarks and changed
 *                              ALRSIGNONRQST
 * 15   05/14/02  A.Foray       Added messages to support EBS-FX:
 *                              ALRHEARTBEAT   ALRDATARQST  ALRDATARESPONSE
 *                              ALRSIGNONRQST  ALRSIGNONACK
 * 14   08/24/00  CB		Add message for heartbeat stats for LOGCENTRAL
 * 13   10/25/95  YS	        Deleted struct TSEVENTMSG. Commentted on
 *				NN_EventMsg for Ticker.
 * 12   09/25/95  Y. Shen       Added struct TSEVENTMSG for Ticker.
 * 11   04/06/95  EB            Ansi-ize
 * 10   07/12/93  A.Malka       Add StartupELSRqst, StartupELSAck, and
 *                              ELSRqstMsgAck
 * 09   04/30/93  E.Barasch     Add ELSOPTDATA, ELSPOLL and ELSPOLLACK
 *                              Correct comments to Event messages
 * 08   04/22/93  N.Jain        Add prcDeal to DEALSTATUSMAKER
 * 07   04/20/93  E.Howorka	Add fResynch to CREDITUPDATE message
 * 06   04/13/93  N.Jain   	Added SILOMSG structure
 *                              Deleted broadcast struct
 * 05   01/05/93  E.Howorka	Add ckpCcyPair and bQteType to QTEINTERRUPTED
 * 				Move DEALSTATUSMAKER to this file from msg_an.h
 * 04   10/30/92  E.Howorka	Replace bComponentType with bNodeType in BYEMSG
 * 03   10/23/92  E.Barasch     force all bitfields to be 16 bits
 *	          E.Wrzesien	add msg creditupdate,add fields to dealfailed
 *				and rearrange
 * 02	10/15/92  E.Wrzesien	delete logmsg
 * 01	07/14/92  HBC		Initial creation.
 *
 *************************************************************************/

/* Include files */
/* ------------- */
#include "packsave.h"
#include "ebs_defn.h"

/******************************************************************************
                    COMMON MESSAGE STRUCTURE TYPEDEFS 

		Messages common to 2 or more node pairs			

   Each message contains the message name, the owner of the message, a brief
   comment, the structure of the message and the structure variable prefix.
******************************************************************************/

/*
   NAME :NA_QteInterrupted
   NAME :AA_QteInterrupted
   DESC :The quote is interrupted if a link failure is detected.
*/
typedef struct _QTEINTERRUPTED  *PQTEINTERRUPTED;               /* pqint */
typedef struct _QTEINTERRUPTED                                  /*  qint */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           EBSTRANSID          etiQteId;                   
        }QTEINTERRUPTED;


/*
   NAME :AA_DealFailed
   DESC :This message is sent by the maker's Arbitrator to the taker's
         Arbitrator when the message NA_DealFailed is returned by the
         maker's MAN.

   NAME :NA_DealFailed
   DESC :This message is sent by the maker's Market Access Node in response
         to AN_HitNotify message if the targeted quote is found  to be
    	 interrupted or when there is no available credit with the counterparty.
*/
typedef struct _DEALFAILED  *PDEALFAILED;                       /* pdf */
typedef struct _DEALFAILED                                      /*  df */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           EBSTRANSID          etiQteId; 
           EBSDEALID           ediDealId;
           FXBYTE              bDealFailType;
        }DEALFAILED;



/*
   NAME :AA_DealStatusMaker
   NAME :NA_DealStatusMaker
   DESC :This message is sent by the maker's MAN after a deal has been
         completed with a counterparty.  If the deal did not succeed,
         DealAmtFinal is set to zero.
*/
typedef struct _DEALSTATUSMAKER  *PDEALSTATUSMAKER;             /* pdsm */
typedef struct _DEALSTATUSMAKER                                 /*  dsm */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           EBSTRANSID          etiQteId; 
           EBSDEALID           ediDealId; 
	   FXBYTE	       bDealStatus;
           FXBASEAMT           baDealAmtFinal;
           FXBOOL              fCreditOk;
           FXUSHORT            usTicketNumMaker;
	   FXULONG             ulMsecDeltaDealPending;
           FXPRICE             prcDeal;
        }DEALSTATUSMAKER;


/*
   NAME :AA_DealStatusMaker2
   NAME :NA_DealStatusMaker2
   DESC :This message is sent by the maker's MAN after a deal has been
         completed with a counterparty.  If the deal did not succeed,
         DealAmtFinal is set to zero.  Ther maker's Arbitrator forwards
         the message to the taker's Arbitrator.
*/
typedef struct _DEALSTATUSMAKER2  *PDEALSTATUSMAKER2;             /* pdsm */
typedef struct _DEALSTATUSMAKER2                                 /*  dsm */
        {
           MSGHDREBS           mhebs;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           EBSTRANSID          etiQteId; 
           EBSDEALID           ediDealId; 
	   FXBYTE	       bDealStatus;
           FXBASEAMT           baDealAmtFinal;
           FXUSHORT            usTicketNumMaker;
	   FXULONG             ulMsecDeltaDealPending;
           FXPRICE             prcDeal;
           FXFLRKEY            fkMaker;
           FXFLRKEY            fkTaker;
           FXFLRKEY            fkMakerPB;
           FXFLRKEY            fkTakerPB;
           FXBITFIELD          bfCreditOk               : 1;
           FXBITFIELD          bfExcludeFromMarketData  : 1;
           FXBITFIELD          bfAutomatch              : 1;
           FXBITFIELD          bfTakerSold              : 1; /* FALSE==taker
                                                                bought */
           FXBITFIELD          bfReserved               : 20;
        }DEALSTATUSMAKER2;


typedef struct _DEALSTATUSMAKER3  *PDEALSTATUSMAKER3;             /* pdsm */
typedef struct _DEALSTATUSMAKER3                                 /*  dsm */
        {
           MSGHDREBS           mhebs;
           FXUSHORT            usLength; /* length of payload minus 2 bytes */
           FXUSHORT            usVersion;
           CCYKEYPAIR          ckpCcyPair;
           FXBYTE              bQteType;
           EBSTRANSID          etiQteId; 
           EBSDEALID           ediDealId; 
	   FXBYTE	       bDealStatus;
           FXBASEAMT           baDealAmtFinal;
           FXUSHORT            usTicketNumMaker;
	   FXULONG             ulMsecDeltaDealPending;
           FXPRICE             prcDeal;
           FXFLRKEY            fkMaker;
           FXFLRKEY            fkTaker;
           FXFLRKEY            fkMakerPB;
           FXFLRKEY            fkTakerPB;
           FXBITFIELD          bfCreditOk               : 1;
           FXBITFIELD          bfExcludeFromMarketData  : 1;
           FXBITFIELD          bfAutomatch              : 1;
           FXBITFIELD          bfTakerSold              : 1; /* FALSE==taker
                                                                bought */
           FXBITFIELD          bfReserved               : 20;
	   FXPRICE             prcEffectiveDealPrice;
           FXCHAR              Reserved[500];
        }DEALSTATUSMAKER3;


/*
   NAME :BL_FeedStop
   NAME :TL_FeedStop
   DESC :Sent by the Billing and Ticker functions to stop the data feed.
*/
typedef struct _FEEDSTOP  *PFEEDSTOP;                           /* pfs */
typedef struct _FEEDSTOP                                        /*  fs */
        {
           MSGHDREBS           mhebs;
        }FEEDSTOP;

/*
   NAME :BL_FeedRange
   NAME :TL_FeedRange
   DESC :Sent by the Billing and Ticker functions to request a specific
         range of data.
*/
typedef struct _FEEDRANGE  *PFEEDRANGE;                         /* pfr */
typedef struct _FEEDRANGE                                       /*  fr */
        {
           MSGHDREBS           mhebs;
           FXTIMESTAMP         tsStart;
           FXTIMESTAMP         tsEnd;
        }FEEDRANGE;


/*
   NAME :BL_FeedInitiate
   NAME :TL_FeedInitiate
   DESC :Sent by the Billing and Ticker functions to initiate a continuous data
         feed. If a start date and time are specified, the feed sends all data
         received since the specified date and time.  If a start date and time
         are not specified, only data received subsequent to this message is
         sent.
*/
typedef struct _FEEDINITIATE  *PFEEDINITIATE;                   /* pfi */
typedef struct _FEEDINITIATE                                    /*  fi */
        {
           MSGHDREBS           mhebs;
           FXTIMESTAMP         tsStart;
        }FEEDINITIATE;


/*
   NAME :LB_FeedTerminate
   NAME :LT_FeedTerminate
   DESC :Sent by the Log Manager to the Billing and Ticker functions when the
         Log Manager is terminating the feed. Upon receipt of this message,
         the Billing and Ticker functions reconnect to the secondary Log
         Manager and request it to begin sending the data feed.
*/
typedef struct _FEEDTERMINATE  *PFEEDTERMINATE;                 /* pft */
typedef struct _FEEDTERMINATE                                   /*  ft */
        {
           MSGHDREBS           mhebs;
        }FEEDTERMINATE;


typedef struct _SILOMSG   *PSILOMSG;                            /* psm */
typedef struct _SILOMSG                                         /*  sm */
        {
          MSGHDREBS   mhebs;
          FXCHAR      achTraderId [DIM_TRADER_ID];
          FXTIMESTAMP tsTimeForEntryRetention;
          FXBYTE      bSiloMsgType;
          SILOINFO    siSiloInfo;
        } SILOMSG;




/*
   NAME :AD_ByeMsg
   NAME :AH_ByeMsg
   NAME :AL_ByeMsg
   NAME :AN_ByeMsg
   NAME :DA_ByeMsg
   NAME :DN_ByeMsg
   NAME :LA_ByeMsg
   NAME :NA_ByeMsg
   NAME :ND_ByeMsg
   DESC :
*/
typedef struct _BYEMSG  *PBYEMSG;                           /* pbm */
typedef struct _BYEMSG                                      /*  bm */
        {
           MSGHDREBS           mhebs;
           FXBYTE              bNodeType;
        }BYEMSG;



/*
   NAME :AD_ByeAckMsg
   NAME :AL_ByeAckMsg
   NAME :AN_ByeAckMsg
   DESC :
*/
typedef struct _BYEACKMSG  *PBYEACKMSG;                        /* pbam */
typedef struct _BYEACKMSG                                      /*  bam */
        {
           MSGHDREBS           mhebs;
        }BYEACKMSG;





/*
   NAME :LL_LogMsgNone
   DESC :Sent between Log Managers, following a Resynchronize message, when
         there is no data to be sent.
   NAME :LH_LogMsgNone
   DESC :Sent to the Help Desk, in response to a Log Request message, when
         there is no data to be sent.
*/
typedef struct _LOGMSGNONE  *PLOGMSGNONE;                       /* plln */
typedef struct _LOGMSGNONE                                      /*  lln */
        {
           MSGHDREBS           mhebs;
        }LOGMSGNONE;


/*
   NAME :AH_EventMsg
   NAME :AL_EventMsg
   NAME :AN_EventMsg
   NAME :NA_EventMsg
   NAME :NH_EventMsg
   NAME :NN_EventMsg
   NAME :NW_EventMsg
   DESC :
*/
typedef struct _EVENTMSG  *PEVENTMSG;                           /* pem */
typedef struct _EVENTMSG                                        /*  em */
        {
           MSGHDREBS           mhebs;
           FXTIMESTAMP         tsEventTime;
           FXSHORT             sEventCode;
        }EVENTMSG;



/*
   NAME :XE_ELSRQSTMSG
   DESC :Sent between Error Log Servers and from the Error log server
	 API to help desks and DEC support.
*/

typedef struct _ELSRQSTMSG *PELSRQSTMSG;			/* perm */
typedef struct _ELSRQSTMSG { 					/*  erm */
	MSGHDREBS 	mhebs;
	FXULONG 	ulElsErrCode;
	FXULONG 	ulElsStatus;
	FXTIMESTAMP     tsElsTime;
	NETLADDR 	netlSrcAddr;
	FXULONG 	ulElsLineNum;
	FXBYTE		bElsApplication;
        FXBITFIELD 	bfElsDest       : 4;
	FXBITFIELD 	bfDecnetEvent   : 1;
        FXBITFIELD                      : 11;           /* pad to short */
        FXSHORT		sElsNumRetries;
	FXBOOL		bElsSend;
	FXCHAR 		achFileName[DIM_VMS_FILENAME_SIZE];
        ELSOPTDATA      eodOptData;
	} ELSRQSTMSG;  /* request message to error logging server */ 



/*

   NAME :AA_CreditUpdate
   NAME :NA_CreditUpdate
   DESC :This message specifies that a credit floor grants (or revokes) credit
          to a number of other trading floors.
*/
typedef struct _CREDITUPDATE    *PCREDITUPDATE;                 /* pcu */
typedef struct _CREDITUPDATE                                    /*  cu */
        {
           MSGHDREBS           mhebs;
           FXFLRKEY            fkFloorKey;
           FXBOOL              fResynch;
           FXBOOL              fCreditOk;
           FXBOOL              fMsgMore;
           FXBYTE              bItemCnt;
           FXFLRKEY            afkCparty [DIM_MAX_FLR_KEYS];
         }CREDITUPDATE;



/*
   NAME :AA_CreditUpdate2
   DESC :This message specifies that a credit floor grants (or revokes) credit
          to a number of other trading floors.

   NOTE: although this message structure is currently only used for
         Arb-to-Arb messages, the intent is to one day also use it
         for floor-to-Arb messages, hence the structure is defined
         here in MSG_XY.H rather than in MSG_AA.H

*/
typedef struct _CREDITUPDATE2    *PCREDITUPDATE2;               /* pcu */
typedef struct _CREDITUPDATE2                                   /*  cu */
        {
           MSGHDREBS           mhebs;
           FXFLRKEY            fkFloorKey;
           FXBOOL              fResynch;
           FXBOOL              fCreditOk;
           FXBOOL              fMsgMore;
           FXUSHORT            usItemCnt;
           FXFLRKEY            afkCparty [DIM_MAX_FLR_KEYS_AA];
         }CREDITUPDATE2;



/*
    NAME :EH_StartupELSRqst
    DESC :Sent after a connection attempt by an ELS dispatcher to Helpdesk ELS
*/
typedef struct _STARTUPELSRQST  *PSTARTUPELSRQST;               /* pser */
typedef struct _STARTUPELSRQST                                  /*  ser */
        {
           MSGHDREBS           mhebs;
        }STARTUPELSRQST;




/*
    NAME :HE_StartupELSAck
    DESC :Sent by ELS on helpdesk in response to a EH_StartupELSRqst message
          from the remote ELS dispatcher; the remote dispatcher can then send
          an ELSRqstMsg
*/
typedef struct _STARTUPELSACK  *PSTARTUPELSACK;                 /* psea */
typedef struct _STARTUPELSACK                                   /*  sea */
        {
           MSGHDREBS           mhebs;
        }STARTUPELSACK;




/*
    NAME :HE_ELSRqstMsgAck
    DESC :Sent by ELS on helpdesk in response to a XE_ELSRqstMsg message from
          the remote ELS dispatcher; the remote dispatcher can then send
          another ELSRqstMsg
*/
typedef struct _ELSRQSTMSGACK  *PELSRQSTMSGACK;                 /* perma */
typedef struct _ELSRQSTMSGACK                                   /*  erma */
        {
           MSGHDREBS           mhebs;
        }ELSRQSTMSGACK;

/*
     NAME :NA_TSHEARTBEATSTATS
     DESC :Message sent to the Trade Server via NN_LOGCENTRAL message.
	   Message sent to Arbitrator via NA_LOGCENTRAL message and logged
		to the Log Manager by the Arbitrator.
*/
typedef struct _TSHEARTBEATSTATS  *PTSHEARTBEATSTATS;              /* ptsh */
typedef struct _TSHEARTBEATSTATS                                   /* tsh  */
	{
	 MSGHDREBS		mhebs;
	 FXTIMESTAMP		tsBNtimestamp;
	 FXFLRKEY		fkFlrKey;
	 FXUSHORT		usNumHeartbeatStats;
	 WSHEARTBEATSTATSDATA	awhsdWSHeartbeatStatsData[DIM_WS_DELAY_STATS];
	}TSHEARTBEATSTATS;


/*
    Name: ALRHeartBeat
        Sent by the log reader when there is no other data to send.
*/

typedef struct _ALRHEARTBEAT *PALRHEARTBEAT;
typedef struct _ALRHEARTBEAT
    {
        MSGHDREBS       mhebs;
        FXTIMESTAMP     tsALRHeartbeat;
        FXUSHORT        usCurrentSessionNumber;
    } ALRHEARTBEAT;

/*
    Name: ALRDataRqst
        Sent to the log file reader to request data from a specific
        session or a specific date.
*/

typedef struct _ALRDATAITEM *PALRDATAITEM;
typedef struct _ALRDATAITEM
    {
        FXUSHORT    usMsgType;
        FXUSHORT    usSessionNumber;
        FXULONG     ulMsgSeqNumber;
    } ALRDATAITEM;

typedef struct _ALRDATARQST *PALRDATARQST;
typedef struct _ALRDATARQST
    {
        MSGHDREBS       mhebs;
        FXTIMESTAMP     tsALRDataRqst;
        FXBYTE          bItemCnt;
        ALRDATAITEM     adiALRDataRqst[DIM_MAX_DATA_RQST];
} ALRDATARQST;

/*
    Name: ALRDataResponse
        Sent by the log file reader to provide log entries to MRF.
*/

typedef struct _ALRDATARESPONSE *PALRDATARESPONSE;
typedef struct _ALRDATARESPONSE
    {
        MSGHDREBS       mhebs;
        FXTIMESTAMP     tsTimestamp;
        FXULONG         ulMsgSeqNumber;
        FXUSHORT        usSessionNumber;
        FXBOOL          fCurrent;
        FXBYTE          bDummy;
        FXBYTE          bMessageData[DIM_MAX_ALR_DATA];
    } ALRDATARESPONSE;

/*
    Name: ALRDataResponse2
        Sent by the log file reader to provide log entries to MRF.
*/

typedef struct _ALRDATARESPONSE2 *PALRDATARESPONSE2;
typedef struct _ALRDATARESPONSE2
    {
        MSGHDREBS       mhebs;
        FXTIMESTAMP     tsTimestamp;
        FXULONG         ulMsgSeqNumber;
        FXUSHORT        usSessionNumber;
        FXBOOL          fCurrent;
        FXUSHORT        usSize;
        FXBYTE          bMessageData[DIM_MAX_ALR_DATA];
    } ALRDATARESPONSE2;

/*
    Name: ALRBatchResponse
        Sent by the log file reader to provide log entries to MRF.
*/

typedef struct _ALRBATCHRESPONSE *PALRBATCHRESPONSE;
typedef struct _ALRBATCHRESPONSE
    {
        MSGHDREBS       mhebs;
        FXUSHORT        usDataSize;
        FXBYTE          bItemCnt;
        FXBYTE          bBatchData[DIM_MAX_ALR_BATCH];
    } ALRBATCHRESPONSE;

/*
    Name: ALRSignonRqst
        Sent to the log file reader to initiate a connection.
*/

typedef struct _ALRSIGNONRQST *PALRSIGNONRQST;
typedef struct _ALRSIGNONRQST
    {
        MSGHDREBS       mhebs;
        FXULONG         ulMessageRate;    
    } ALRSIGNONRQST;

/*
    Name: ALRSignonRsqtAck
        Sent by the log file reader to accept a connection from MRF.
*/

typedef struct _ALRSIGNONACK *PALRSIGNONACK;
typedef struct _ALRSIGNONACK
    {
        MSGHDREBS       mhebs;
        FXUSHORT        usCurrentSessionNumber;
    } ALRSIGNONACK;

/*
    Name: StopALRDataRqst
        Sent by the MRF to remove a message from the list of messages.
*/

typedef struct _STOPALRDATARQST *PSTOPALRDATARQST;
typedef struct _STOPALRDATARQST
    {
        MSGHDREBS       mhebs;
        FXUSHORT        usALRMsgType;
    } STOPALRDATARQST;


/*
    Name: ApplHeartbeat
        Sent by any application component to any other.
*/

typedef struct _APPLHEARTBEAT *PAPPLHEARTBEAT;
typedef struct _APPLHEARTBEAT
{
  MSGHDREBS     mhebs;
  FXBYTE        bItemCnt;
  FXBYTE        abData[DIM_MAX_APPL_HEARTBEAT];
} APPLHEARTBEAT;


#include "packrest.h"
#endif
/* end of file msg_xy.h */
